<!doctype html><html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <div class="datalist"><table id="flexigrid" style="display:none"></table></div>
        <script type="text/javascript">
            $(function() {
                $("#flexigrid").flexigrid($.extend(SG.flexOptions, {
                    url: '<?= site_url('channel/channelmgr/flexigrid') ?>',
                    colModel: [
                        {display: '<?= translate('CHANNEL_ID') ?>', name: 'id', width: 80, iskey: true},
                        {display: '<?= translate('CHANNEL_NAME') ?>', name: 'channel', width: 80},
                        {display: '<?= translate('GENERAL_MANAGER_MANAGER') ?>', name: 'manager', width: 150},
                        {display: '<?= translate('GENERAL_MANAGER_ADDTIME') ?>', name: 'addtime', width: 150},
                        {display: '<?= translate('MANAGE') ?>', name: 'id', width: 100, sortable: false, process: formatOp}
                    ],
                    buttons: [
                        {name: 'add', displayname: "<?= translate('ADD') ?>", title: "<?= translate('ADD') ?>", bclass: 'add', onpress: multi},
                        {name: 'delete', displayname: "<?= translate('DEL') ?>", title: "<?= translate('DEL') ?>", bclass: 'delete', onpress: multi},
                        {name: 'export', displayname: "<?= translate('EXPORT') ?>", bclass: 'export', onpress: multi},
                    ],
                    searchitems: true,
                }));
                SG.admin = $.extend(SG.admin, {
                	add_url: '<?= site_url("channel/channelmgr/add") ?>',
                    //edit_url: '<?= site_url("channel/channelmgr/edit/") ?>',
                    del_url: '<?= site_url("channel/channelmgr/del/") ?>',
                });


              function toolbarItem(com, grid) {     
            	  var ids = $("#flexigrid").getCheckedRows();  
                  alert('com = '+com+" grid = "+grid+" ids = "+ids);      
                  if (com=='copyToOther'){          
                      if($('.trSelected',grid).length==0){
                        hiAlert("请选择要删除的数据!");
                      }
                      else{
                        hiConfirm('是否删除这 ' + $('.trSelected',grid).length + ' 条记录吗?', '操作提示', function(r)  {              
                          if(r){
                              var  ids ="";
                              $('.trSelected td:nth-child(2)',grid).each(function(){
                                  ids+=","+$(this).text();
                                });
                              ids=ids.substring(1);
                              $.ajax({
                                  type: "POST",
                                  url: "<%=basePath %>admin/UserManagerServlet?action=delete",
                                  data: "ids="+ids, 
                                  dataType:"text",
                                  success: function(msg){
                                      if(msg=="success"){
                                          hiAlert("操作成功！");
                                          $("#JUserTable").flexReload();
                                          }else{
                                              hiAlert("有错误发生,msg="+msg);
                                          }
                                      },
                                      error: function(msg){
                                          hiAlert("msg="+msg);
                                        }
                                      });
                              }
                          });
                      }
                  }
              }

            });
        </script>
    </body>
</html>